package com.example.demo.schedule;

import com.example.demo.entity.dto.QWMessageDto;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.sql.Timestamp;
import java.util.Arrays;
import java.util.Date;

/**
 * @Author: lu
 * @Date: 2024-08-26-15:57
 * @Description:
 */
@EnableScheduling
@Configuration
public class NotifyTask {

    //企业消息推送
    @Scheduled(cron = "10 * * * * ?")
    public  void sendmsg(){
        Date date = new Date();
        Timestamp timestamp = new Timestamp(date.getTime());
        QWMessageDto qWMessageDto = new QWMessageDto();
        qWMessageDto.setUserids(Arrays.asList(1684713));
        qWMessageDto.setUrl("https://qyapi.weixin.qq.com/cgi-bin/message/send/");
        qWMessageDto.setDesc(
                "类型:  特检维护提醒  \n" +
                        "名称:【" + 1 + "】  \n" +
                        "内容:【" + 2 + "】已到期!  \n" +
                        "请立即进入系统处理!  \n" +
                        "下次维护时间" + timestamp);

    }

}
